package com.library.web.controller.tool;

import com.library.common.core.domain.AjaxResult;
import com.library.framework.config.CosConfig;
import com.library.framework.manager.CosUploadManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author julyWhj
 * @Description 新增对象存储文件上传$
 * @Date 2022/3/22 6:31 下午
 **/
@RestController
@RequestMapping("/cosUpload")
public class CosUploadController {
    @Autowired
    private CosConfig cosConfig;
    @Autowired
    private CosUploadManager cosUploadManager;

    @GetMapping
    public AjaxResult cosUploadFile(String name) {
        String uploadUrl = cosUploadManager.getUploadUrl(cosConfig, name);
        return AjaxResult.success(uploadUrl);
    }
}
